home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / SOUNDC.ARJ / DEMO_C.DOC < prev    next >
Text File  |  1992-07-11  |  4KB  |  88 lines

  1.  
  2.                           SOUND_C.ZIP
  3.                   (Borland) C Sound Generation
  4.  
  5.     Pascal version by..                 C Translation by..
  6.       Nels Anderson                        John Gallant
  7.      92 Bishop Drive                 1249 Cedar Creek Circle
  8.   Framingham, MA  01701                  Dayton OH 45459
  9.  
  10.  
  11.  
  12.     These notes are supplimental to the text by Nels Anderson 
  13. describing SOUNDPAS.ARC which should be read first. The 
  14. translation was without modification wherever possible. The 
  15. program was split into smaller files as follows: 
  16.  
  17.     sounder.c   -- The basic section of code you would include 
  18.                    with your program. This section has the 
  19.                    routines to initialize the driver, the 
  20.                    interrupt driver itself, and the routine to 
  21.                    remove the driver.
  22.  
  23.     sounder.h   -- The header file associated with the above.
  24.  
  25.     demo_c.c    -- A slightly embellished version of the 
  26.                    DEMO2.PAS. This is the demo program to call 
  27.                    and demonstrate the use of the routines above. 
  28.  
  29.     sounds.c    -- A data file with the sample songs and sounds.
  30.  
  31.     sounds.h    -- The header file with the names of the songs 
  32.                    and sounds in the above file.
  33.  
  34.     sndnotes.h  -- A file containing the #define's for note 
  35.                    names/values.
  36.  
  37.     The programs are set to compile under Borland C but a switch 
  38. is available in sounder.h to convert to a C++ compatible syntax. 
  39. Some modification will be required if you are not using a Borland 
  40. C compiler but I hope those changes are minor. 
  41.  
  42.     The noninterrupt version of the Pascal programs has not been 
  43. translated at this time. It is left as "an exercise for the 
  44. student". (I always wanted to be able to do that!)
  45.  
  46.  
  47.     WARNING: The interrupt routine does not call the routine it 
  48. replaces when it is done. If the original routine was critical to 
  49. maintaining the system clock for example, you should add code to 
  50. the end of the driver (TimerInt()) to call the original routine. 
  51. Remember that the original vector address is an interrupt routine 
  52. and appropriate steps must be taken to treat the stack 
  53. accordingly. One possibility is to install the old vector at an 
  54. unused "user" vector and then call it as an interrupt. Borland 
  55. has appropriate routines for doing this.
  56.  
  57.     You should also note that if a program exits without 
  58. replacing the original vector the system is likely to crash. When 
  59. the timer interrupt occurs, the system will branch to a 
  60. meaningless section of memory. Your guess is as good as mine as 
  61. to what will happen then. 
  62.  
  63.     It is not sufficient to count on your program exiting in a 
  64. nice way. Control-break or critical-error interrupts can take 
  65. control of your program and cause it to exit without cleaning up 
  66. the vector table. If you are using this code in any serious 
  67. program then you should take steps to deal with these 
  68. possibilities. 
  69.  
  70.     SECOND WARNING: Since you are dealing with low level 
  71. functions of the PC you should take additional care with your 
  72. work. Changing the wrong vector or not removing the vector at the 
  73. end of the program can (and will) lead to system crashes. This 
  74. code has been checked and found to be safe and operational but it 
  75. has been kept simple (and not bullet proof) for instructional 
  76. purposes. The user must assume all responsibility for its use. 
  77.  
  78.  
  79.     As Nels said, these routines are released to the public 
  80. domain. If (on the C version) you have comments, suggestions, 
  81. complaints, or a good recipe for brownies you can contact me via 
  82. CompuServe at 76170,2251 or by mail at the above address, or by 
  83. phone at (513)-436-0232. I will not have time to solve major 
  84. problems but I would like to help if possible. 
  85.  
  86. John Gallant
  87.  
  88.